/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package interfaz;

import java.awt.Color;
import java.awt.Graphics;

/**
 *
 * @author victor
 */
public class iProgress extends iWidget {
    private float status = 0;
    private Color color = Color.WHITE;
    private boolean block = false;
    
    public iProgress (int x, int y) {
        super (x,y);
    }
    
    public void setColor (Color color) {
        this.color = color;
    }
    
    public Color getColor() {
        return this.color;
    }
    
    public void setStatus (int status) {
        this.status = (float) status/100;
    }
    
    public int getStatus () {
        return (int) this.status*100;
    }
    
    public void setBlock(boolean status) {
        this.block = status;
    }
    
    public void paint (Graphics g) {
        int barSize = getWidth()-getX();
        g.setColor(getColor());
        g.drawRoundRect(getX(),getY(),getWidth(),getHeight(),10,10);
        if (block) g.fillRoundRect(getX()+(int) (status*barSize), getY(),
                50, getHeight(), 10, 10);
        else g.fillRoundRect(getX(), getY(),
                +(int) (status*barSize), getHeight(), 10, 10);
    }
}
